import { ref, computed } from "vue";
import { defineStore } from "pinia";


export const useStore = defineStore("store01", {
  state:()=>{
    return {
      age:16
    }
  },
  getters: {
    isAdult: (state) => state.age>=18?"已成年":"未成年",
  },
  actions:{
    upAge(){
      this.age++;
    }
  }
});



// 类似于setup函数里的写法
export const useStore02 = defineStore("store02",()=>{
    const count = ref(3);

    function addCount(){
      count.value++;
    }

    return {
      count,addCount
    }

});
